function initDict(url, pageType, operation) {
    var allNodes = document.getElementsByTagName('*');
    var node;
    var str = "";
    var dictStr = "[";
    for (var i = 0; i < allNodes.length; i++) {
        node = allNodes[i];
        var divId = "";//divId
        var divName = "";//divName
        var id = "";//数据字典标签对应id
        var name = "";//数据字典标签对应name
        var dict = "";//数据字典项
        var dicType = "";//标签类型
        var length = "";//长度，只有select下拉框才设置长度
        var value = "";//当前选中的值
        var method = "";//方法
        var diabled = "";//是否不可编辑
        var defaultValue = "";//默认值
        var required = "";//是否必填
        var readonly = "";//是否只读
        var chooseList = "";//选择要加载的数据字典项
        var subList = "";//要移除的字典项
        if (node.hasAttribute('dict')) {
            divId = node.getAttribute('id');
            divName = node.getAttribute('name');
            id = divId.replace("Group", "");
            if (divName != null && divName != '') {
                name = divName.replace("Group", "");
            }
            dict = node.getAttribute('dict');
            dicType = node.getAttribute('dicType');
            length = node.getAttribute('length');
            value = node.getAttribute("value");
            method = node.getAttribute("method");
            disabled = node.getAttribute("disabled");
            defaultValue = node.getAttribute("defaultValue");
            readonly = node.getAttribute("readonly");
            required = node.getAttribute("required");
            chooseList = (node.getAttribute("chooseList") == null ? '' : node.getAttribute("chooseList"));
            subList = (node.getAttribute("subList") == null ? '' : node.getAttribute("subList"));
            str += "{'id':'" + id + "','dict':'" + dict + "','dicType':'" + dicType + "','divId':'" + divId + "','length':'" + length + "','value':'" + value + "','method':'" + method + "','divName':'" + divName + "','name':'" + name + "','disabled':'" + disabled + "','defaultValue':'" + defaultValue + "','readonly':'" + readonly + "','required':'" + required + "','chooseList':'" + chooseList + "','subList':'" + subList + "'},";
        }
    }
    if (str != '' && str != null) {
        dictStr += str.substr(0, str.length - 1) + "]";
        var data =
            {
                dictStr: dictStr
            };
        Jmts.ajaxPost(url, data, function (result) {
            if (result.success) {
                var dictList = eval(result.resultData.dictList);
                for (var o in dictList) {
                    var code = dictList[o].code;//数据字典编码
                    var itemList = eval(dictList[o].itemList);//数据字典集合
                    var id = dictList[o].id;//id
                    var name = dictList[o].name;//name
                    var dicType = dictList[o].dicType;//当前标签类型select,checkbox,radio
                    var divId = dictList[o].divId;//包裹标签类型的div id
                    var divName = dictList[o].divName;//包裹标签类型的div name
                    var classStyle = "";//样式，只有select用到
                    var length = dictList[o].length;//长度，根据长度设置样式
                    var value = dictList[o].value;//值
                    var method = dictList[o].method;//方法
                    var disabled = dictList[o].disabled;//是否不可编辑
                    var defaultValue = dictList[o].defaultValue;//默认值
                    var readonly = dictList[o].readonly;//是否可读
                    var required = dictList[o].required;//是否必填
                    var str = "";

                    if (itemList != null && itemList.length > 0) {
                        if (name == null || name == '') {
                            name = id;
                        }
                        if (dicType == 'select') {
                            (length == null || length == '') ? classStyle = "col-sm-2" : classStyle = "col-sm-" + length;
                            str += "<select id='" + id + "' name='" + name + "' class='" + classStyle + " form-control'";
                            if (operation == 'view') {
                                str += " disabled='disabled'";
                            } else {
                                if (disabled != null && (disabled == "disabled" || disabled == 'true' || disabled == true)) {
                                    str += " disabled='disabled'";
                                }
                            }
                            if (required != null && required != '' && (required == "required" || required == true)) {
                                str += " required='required'";
                            }
                            if (method != null && method != '' && method != undefined && method != 'null') {
                                str += " onchange='" + method + "'>";
                            } else {
                                str += ">";
                            }
                            str += "<option value=''>--请选择--</option>";
                            for (var i = 0; i < itemList.length; i++) {
                                //如果value不为空，则看是否有设置defaultValue
                                if (value != null && value != '' && value != 'undefined') {
                                    if (value == itemList[i].itemValue) {
                                        str += "<option value='" + itemList[i].itemValue + "' selected='selected'>" + itemList[i].itemName + "</option>";
                                    } else {
                                        str += "<option value='" + itemList[i].itemValue + "'>" + itemList[i].itemName + "</option>";
                                    }
                                } else {
                                    //如果设置了默认值，则
                                    if (defaultValue == itemList[i].itemValue) {
                                        str += "<option value='" + defaultValue + "' selected='selected'>" + itemList[i].itemName + "</option>";
                                    } else {
                                        str += "<option value='" + itemList[i].itemValue + "'>" + itemList[i].itemName + "</option>";
                                    }

                                }
                            }
                            str += "</select>";
                        } else if (dicType == 'checkbox') {//checkbox可能是多选
                            for (var i = 0; i < itemList.length; i++) {
                                str += "<div class='checkbox checkbox-inline'>"
                                str += "<input type='checkbox' id='" + id + "' name='" + name + "' value='" + itemList[i].itemValue + "'";
                                if (required != null && required != '' && (required == "required" || required == true)) {
                                    str += " required='required'";
                                }
                                if (value != null && value != '' && value != 'undefined' && value != undefined) {
                                    if (value.indexOf(itemList[i].itemValue) > -1) {
                                        str += " checked='checked'";
                                    }
                                } else {
                                    if (defaultValue.indexOf(itemList[i].itemValue) > -1) {
                                        str += " checked='checked'";
                                    }
                                }
                                if (operation == 'view') {
                                    str += " disabled='disabled'";
                                } else {
                                    if (disabled != null && disabled != '' && (disabled == "disabled" || disabled == 'true')) {
                                        str += " disabled='disabled'";
                                    }
                                }
                                if (method != null && method != '' && method != 'null') {
                                    str += " onclick='" + method + "'";
                                }
                                str += "'/><label for='" + id + "'>" + itemList[i].itemName + "</label></div>";
                            }
                        } else if (dicType == 'radio') {
                            for (var i = 0; i < itemList.length; i++) {
                                str += "<div class='radio radio-inline'>";
                                str += "<input type='radio'  id='" + id + "' name='" + name + "' value='" + itemList[i].itemValue + "'";
                                if (required != null && required != '' && (required == "required" || required == true)) {
                                    str += " required='required'";
                                }
                                if (value != null && value != '' && value != 'undefined') {
                                    if (value == itemList[i].itemValue) {
                                        str += " checked='checked'";
                                    }
                                } else {
                                    if (defaultValue == itemList[i].itemValue) {
                                        str += " checked='checked'";
                                    }
                                }
                                if (operation == 'view') {
                                    str += " disabled='disabled'";
                                } else {
                                    if (disabled != null && (disabled == "disabled" || disabled == 'true')) {
                                        str += "disabled='disabled'";
                                    }
                                }
                                if (method != null && method != '' && method != 'null') {
                                    str += " onclick='" + method + "'";
                                }
                                str += "'/><label for='" + id + "'>" + itemList[i].itemName + "</label></div>";
                            }
                        } else if (dicType == 'text') {
                            (length == null || length == '') ? classStyle = "col-sm-2" : classStyle = "col-sm-" + length;
                            if (pageType == 'index') {
                                classStyle = "form-control";
                            }
                            var textValue = "";
                            for (var i = 0; i < itemList.length; i++) {
                                if (value != null && value != '' && value != 'undefined') {
                                    if (value.indexOf(itemList[i].itemValue) > -1) {
                                        textValue += itemList[i].itemName + ",";
                                    }
                                } else {
                                    if (defaultValue.indexOf(itemList[i].itemValue) > -1) {
                                        textValue += itemList[i].itemName + ",";
                                    }
                                }

                            }
                            if (textValue != null && textValue != '') {
                                textValue = textValue.substr(0, textValue.length - 1);
                            }
                            str += "<input type='text' id='" + id + "' name='" + name + "' value='" + textValue + "' class='" + classStyle + "'";
                            if (required != null && required != '' && (required == "required" || required == true)) {
                                str += " required='required'";
                            }
                            if (operation == 'view') {
                                str += " readonly='readonly'";
                            } else {
                                if (readonly != null && readonly != '' && (readonly == "readonly" || readonly == 'true')) {
                                    str += " readonly='readonly'";
                                }
                            }
                            str += "/>";
                            /*//如果必填，则加必填标志
                            if(required != null && required != '' && (required == "required" || required== true)){
                                str += "<div class='col-sm-1'><label class='required'>*</label></div>";
                            }*/
                        }
                    }
                    var dicts = document.getElementsByName(divName);
                    if (dicts != null && dicts.length > 0) {
                        for (var i = 0; i < dicts.length; i++) {
                            dicts[i].innerHTML = str;
                        }
                    } else {
                        document.getElementById(divId).innerHTML = str;
                    }
                }

            } else {
                Jmts.warnTips(result.msg);
            }
        });
    }
}

function initDict2(url, pageType, operation, callback) {
    var allNodes = document.getElementsByTagName('*');
    var node;
    var str = "";
    var dictStr = "[";
    for (var i = 0; i < allNodes.length; i++) {
        node = allNodes[i];
        var divId = "";//divId
        var divName = "";//divName
        var id = "";//数据字典标签对应id
        var name = "";//数据字典标签对应name
        var dict = "";//数据字典项
        var dicType = "";//标签类型
        var length = "";//长度，只有select下拉框才设置长度
        var value = "";//当前选中的值
        var method = "";//方法
        var diabled = "";//是否不可编辑
        var defaultValue = "";//默认值
        var required = "";//是否必填
        var readonly = "";//是否只读
        var chooseList = "";//选择要加载的数据字典项
        var subList = "";//要移除的字典项
        if (node.hasAttribute('dict')) {
            divId = node.getAttribute('id');
            divName = node.getAttribute('name');
            id = divId.replace("Group", "");
            if (divName != null && divName != '') {
                name = divName.replace("Group", "");
            }
            dict = node.getAttribute('dict');
            dicType = node.getAttribute('dicType');
            length = node.getAttribute('length');
            value = node.getAttribute("value");
            method = node.getAttribute("method");
            disabled = node.getAttribute("disabled");
            defaultValue = node.getAttribute("defaultValue");
            readonly = node.getAttribute("readonly");
            required = node.getAttribute("required");
            chooseList = (node.getAttribute("chooseList") == null ? '' : node.getAttribute("chooseList"));
            subList = (node.getAttribute("subList") == null ? '' : node.getAttribute("subList"));
            str += "{'id':'" + id + "','dict':'" + dict + "','dicType':'" + dicType + "','divId':'" + divId + "','length':'" + length + "','value':'" + value + "','method':'" + method + "','divName':'" + divName + "','name':'" + name + "','disabled':'" + disabled + "','defaultValue':'" + defaultValue + "','readonly':'" + readonly + "','required':'" + required + "','chooseList':'" + chooseList + "','subList':'" + subList + "'},";
        }
    }
    if (str != '' && str != null) {
        dictStr += str.substr(0, str.length - 1) + "]";
        var data =
            {
                dictStr: dictStr
            };
        Jmts.ajaxPost(url, data, function (result) {
            if (result.success) {
                var dictList = eval(result.dictList);
                for (var o in dictList) {
                    var code = dictList[o].code;//数据字典编码
                    var itemList = eval(dictList[o].itemList);//数据字典集合
                    var id = dictList[o].id;//id
                    var name = dictList[o].name;//name
                    var dicType = dictList[o].dicType;//当前标签类型select,checkbox,radio
                    var divId = dictList[o].divId;//包裹标签类型的div id
                    var divName = dictList[o].divName;//包裹标签类型的div name
                    var classStyle = "";//样式，只有select用到
                    var length = dictList[o].length;//长度，根据长度设置样式
                    var value = dictList[o].value;//值
                    var method = dictList[o].method;//方法
                    var disabled = dictList[o].disabled;//是否不可编辑
                    var defaultValue = dictList[o].defaultValue;//默认值
                    var readonly = dictList[o].readonly;//是否可读
                    var required = dictList[o].required;//是否必填
                    var str = "";

                    if (itemList != null && itemList.length > 0) {
                        if (name == null || name == '') {
                            name = id;
                        }
                        if (dicType == 'select') {
                            (length == null || length == '') ? classStyle = "col-sm-2" : classStyle = "col-sm-" + length;
                            str += "<select id='" + id + "' name='" + name + "' class='" + classStyle + " form-control'";
                            if (operation == 'view') {
                                str += " disabled='disabled'";
                            } else {
                                if (disabled != null && (disabled == "disabled" || disabled == 'true')) {
                                    str += " disabled='disabled'";
                                }
                            }
                            if (required != null && required != '' && (required == "required" || required == true)) {
                                str += " required='required'";
                            }
                            if (method != null && method != '') {
                                str += " onchange='" + method + "'>";
                            } else {
                                str += ">";
                            }
                            str += "<option value=''>--请选择--</option>";
                            for (var i = 0; i < itemList.length; i++) {
                                if (value != null && value != '' && value != 'undefined') {
                                    if (value == itemList[i].itemValue) {
                                        str += "<option value='" + itemList[i].itemValue + "' selected='selected'>" + itemList[i].itemName + "</option>";
                                    } else {
                                        str += "<option value='" + itemList[i].itemValue + "'>" + itemList[i].itemName + "</option>";
                                    }
                                } else {
                                    //如果设置了默认值，则
                                    if (defaultValue == itemList[i].itemValue) {
                                        str += "<option value='" + defaultValue + "' selected='selected'>" + itemList[i].itemName + "</option>";
                                    } else {
                                        str += "<option value='" + itemList[i].itemValue + "'>" + itemList[i].itemName + "</option>";
                                    }
                                }
                            }
                            str += "</select>";
                            /*//如果必填，则加必填标志
                            if(required != null && required != '' && (required == "required" || required== true)){
                                str += "<div class='col-sm-1'><label class='required'>*</label></div>";
                            }*/
                        } else if (dicType == 'checkbox') {//checkbox可能是多选
                            for (var i = 0; i < itemList.length; i++) {
                                str += "<input type='checkbox'  id='" + id + "' name='" + name + "' value='" + itemList[i].itemValue + "'";
                                if (required != null && required != '' && (required == "required" || required == true)) {
                                    str += " required='required'";
                                }
                                if (value != null && value != '' && value != 'undefined') {
                                    if (value.indexOf(itemList[i].itemValue) > -1) {
                                        str += " checked='checked'";
                                    }
                                } else {
                                    if (defaultValue.indexOf(itemList[i].itemValue) > -1) {
                                        str += " checked='checked'";
                                    }
                                }

                                if (operation == 'view') {
                                    str += " disabled='disabled'";
                                } else {
                                    if (disabled != null && disabled != '' && (disabled == "disabled" || disabled == 'true')) {
                                        str += " disabled='disabled'";
                                    }
                                }
                                if (method != null && method != '') {
                                    str += " onclick='" + method + "'";
                                }
                                str += "'/><label>" + itemList[i].itemName + "</label>";
                            }
                        } else if (dicType == 'radio') {
                            for (var i = 0; i < itemList.length; i++) {
                                str += "<input type='radio'  id='" + id + "' name='" + name + "' value='" + itemList[i].itemValue + "'";
                                if (required != null && required != '' && (required == "required" || required == true)) {
                                    str += " required='required'";
                                }
                                if (value != null && value != '' && value != 'undefined') {
                                    if (value == itemList[i].itemValue) {
                                        str += " checked='checked'";
                                    }
                                } else {
                                    if (defaultValue == itemList[i].itemValue) {
                                        str += " checked='checked'";
                                    }
                                }

                                if (operation == 'view') {
                                    str += " disabled='disabled'";
                                } else {
                                    if (disabled != null && (disabled == "disabled" || disabled == 'true')) {
                                        str += "disabled='disabled'";
                                    }
                                }
                                if (method != null && method != '') {
                                    str += " onclick='" + method + "'";
                                }
                                str += "'/><label>" + itemList[i].itemName + "</label>";
                            }
                        } else if (dicType == 'text') {
                            (length == null || length == '') ? classStyle = "col-sm-2" : classStyle = "col-sm-" + length;
                            if (pageType == 'index') {
                                classStyle = "form-control";
                            }
                            var isExist = false;
                            var textValue = "";
                            for (var i = 0; i < itemList.length; i++) {
                                if (value != null && value != '' && value != 'undefined') {
                                    if (value.indexOf(itemList[i].itemValue) > -1) {
                                        textValue += itemList[i].itemName + ",";
                                    }
                                } else {
                                    if (defaultValue.indexOf(itemList[i].itemValue) > -1) {
                                        textValue += itemList[i].itemName + ",";
                                    }
                                }
                            }
                            if (textValue != null && textValue != '') {
                                textValue = textValue.substr(0, textValue.length - 1);
                            }
                            str += "<input type='text' id='" + id + "' name='" + name + "' value='" + textValue + "' class='" + classStyle + "'";
                            if (required != null && required != '' && (required == "required" || required == true)) {
                                str += " required='required'";
                            }
                            if (operation == 'view') {
                                str += " readonly='readonly'";
                            } else {
                                if (readonly != null && (readonly == "readonly" || readonly == 'true')) {
                                    str += " readonly='readonly'";
                                }
                            }
                            str += "/>";
                            /*//如果必填，则加必填标志
                            if(required != null && required != '' && (required == "required" || required== true)){
                                str += "<div class='col-sm-1'><label class='required'>*</label></div>";
                            }*/
                        }
                    }
                    var dicts = document.getElementsByName(divName);
                    if (dicts != null && dicts.length > 0) {
                        for (var i = 0; i < dicts.length; i++) {
                            dicts[i].innerHTML = str;
                        }
                    } else {
                        document.getElementById(divId).innerHTML = str;
                    }
                }
                callback();
            } else {
                Jmts.warnTips(result.msg);
            }
        });
    }
}